/**
* This is the document class for Parallax.fla, it demonstrates the simple
* usage of the Parallaxer library.
*
* @author Timothy Jordan, captaintimothy@gmail.com
*/
package {
  import flash.display.MovieClip;
  import flash.geom.Point;
  import flash.events.MouseEvent;
  
  import Parallaxer;
  
  public class Parallax extends MovieClip {
    private var _parallaxer;
    
    public function Parallax():void {
      // Instantiate the Parallaxer class and add it to the display list
      _parallaxer = new Parallaxer(stage, false);
      addChild(_parallaxer);
      
      // Add each item to parallax in any order
      _parallaxer.addItem(rock1, 2);
      _parallaxer.addItem(rock2, 2);
      _parallaxer.addItem(sun, 0);
      _parallaxer.addItem(hills, 1, {top: false, right: true, bottom: true, left: true});
      
      // By default, the items parallax on mouse movement, but you may 
      // instead animate it automatically.
      //_parallaxer.startAnimation(new Point(-4, 2));
      
      star.addEventListener(MouseEvent.CLICK, testButton_clicked);
      star.buttonMode = true;
    }
    
    public function testButton_clicked(event:MouseEvent):void {
      star.removeEventListener(MouseEvent.CLICK, testButton_clicked);
      star.buttonMode = false;
      _parallaxer.addItem(star, 2);
    }
  }
}